package com.yanfan.energy.service;


import com.yanfan.energy.domain.Building;
import com.yanfan.energy.domain.Workshop;
import com.yanfan.energy.domain.statist.*;
import com.yanfan.iot.domain.Device;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * 能源系统看板模块接口
 *
 * @author caijinkang
 * @since 2022-09-26 13:57:15
 */
public interface EnergyBoardService {

    /**
     * 楼栋费用统计
     *
     * @param range
     * @param begin
     * @param end
     * @param unit
     * @return java.util.Map<java.lang.String, java.util.List < io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>>
     * @author caijinkang
     * @date 2022/9/30 9:51
     */
    Map<String, List<DateStatistics>> findTotalBoard(String range, LocalDate begin, LocalDate end, Integer unit);

    /**
     * 车间能耗排名
     *
     * @param range
     * @param begin
     * @param end
     * @param unit
     * @return java.util.Map<java.lang.String, java.util.List < io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>>
     * @author caijinkang
     * @date 2022/9/30 9:53
     */
    Map<String, List<DateStatistics>> findWorkshopEnergyNo(String range, LocalDate begin, LocalDate end, Integer unit);

    /**
     * 能源介质分布
     *
     * @param range
     * @param begin
     * @param end
     * @param unit
     * @return java.util.Map<java.lang.String, java.util.List < io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>>
     * @author caijinkang
     * @date 2022/9/30 9:55
     */
    Map<String, List<DateStatistics>> findMediumEnergyNo(String range, LocalDate begin, LocalDate end, Integer unit);

    /**
     * 波峰波谷统计
     *
     * @param range
     * @param begin
     * @param end
     * @param unit
     * @return java.util.Map<java.lang.String, java.util.List < com.ruoyi.common.core.domain.model.DateStatistics>>
     * @author caijinkang
     * @date 2022/10/17 12:14
     */
    Map<String, List<DateStatistics>> findTotalCrest(String range, LocalDate begin, LocalDate end, Integer unit);

    /**
     * 查询车间温度
     *
     * @return java.util.List<com.ruoyi.common.core.domain.model.EnvironmentStatics>
     * @author caijinkang
     * @date 2022/10/17 12:15
     */
    List<EnvironmentStatics> findTemperature();

    /**
     * 查询车间能耗
     *
     * @return java.util.List<com.ruoyi.common.core.domain.model.EnvironmentStatics>
     * @author caijinkang
     * @date 2022/10/17 12:15
     */
    List<EnvironmentStatics> findElectricity();

    /**
     * 总用电监控
     *
     * @param range
     * @param begin
     * @param end
     * @return java.util.Map<java.lang.String, java.util.List < com.ruoyi.common.core.domain.model.DateStatistics>>
     * @author caijinkang
     * @date 2022/10/17 12:15
     */
    Map<String, List<DateStatistics>> findCountElectricity(String range, LocalDate begin, LocalDate end);

    /**
     * 楼层信息查询
     *
     * @return java.util.List<com.ruoyi.common.core.domain.entity.Building>
     * @author caijinkang
     * @date 2022/10/17 12:15
     */
    List<Building> findFloorInformation();

    /**
     * 单价计算
     *
     * @param dateStatistics
     * @param unit
     * @param type
     * @return java.util.List<io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>
     * @author caijinkang
     * @date 2022/9/28 17:03
     */
    List<DateStatistics> findPriceStatistics(List<DateStatistics> dateStatistics, Integer unit, Integer type);

    /**
     * 统计各个车间的所有能耗
     *
     * @param d
     * @return java.util.Map<java.lang.String, java.util.List < io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>>
     * @author caijinkang
     * @date 2022/10/8 10:20
     */
    Map<String, List<DateStatistics>> findWorkshopEnergy(Map<String, List<DateStatistics>> d);

    /**
     * 查询时间范围的统计
     *
     * @param dates
     * @param statistics
     * @return java.util.List<io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>
     * @author caijinkang
     * @date 2022/9/27 15:12
     */
    List<DateStatistics> findDateStatistics(List<String> dates, List<DateStatistics> statistics);

    /**
     * 能源介质分布
     *
     * @param range
     * @param begin
     * @param end
     * @param unit
     * @return java.util.Map<java.lang.String, java.util.List < io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>>
     * @author caijinkang
     * @date 2022/10/9 11:30
     */
    Map<String, List<DateStatistics>> findMediaDistribute(String range, LocalDate begin, LocalDate end, Integer unit);

    /**
     * 统计车间各个能耗
     *
     * @param stringListMap
     * @return java.util.Map<java.lang.String, java.util.List < io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>>
     * @author caijinkang
     * @date 2022/9/29 13:26
     */
    Map<String, List<DateStatistics>> findAllEnergy(Map<String, List<DateStatistics>> stringListMap);

    /**
     * 车间能源数据根据类型
     *
     * @param datetime
     * @param workshopId
     * @param begin
     * @param end
     * @param byType
     * @return java.util.Map<java.lang.String, java.util.List < com.ruoyi.common.core.domain.model.DateStatistics>>
     * @author caijinkang
     * @date 2022/10/21 11:33
     */
    Map<String, List<DateStatistics>> findEnergyByType(String datetime, Long workshopId, LocalDate begin, LocalDate end, Integer byType);

    /**
     * 查询所有楼栋
     *
     * @return java.util.List<com.ruoyi.common.core.domain.entity.Building>
     * @author caijinkang
     * @date 2022/10/19 17:25
     */
    List<Building> findAllBuilding();

    /**
     * 根据楼栋id查询所有车间
     *
     * @param buildId
     * @return java.util.List<com.ruoyi.common.core.domain.model.DateStatistics>
     * @author caijinkang
     * @date 2022/10/21 11:33
     */
    List<DateStatistics> findAllWorkshopByBuildId(Integer buildId);

    /**
     * 根据多个车间查询所有设备
     *
     * @param workshops
     * @return java.util.List<com.ruoyi.common.core.domain.entity.IotDevice>
     * @author caijinkang
     * @date 2022/10/19 17:41
     */
    List<Device> findAllDeviceByWorkshop(List<Workshop> workshops);

    /**
     * 查询当日能耗
     *
     * @param workshopId
     * @param unit
     * @return io.github.jhipster.sample.sansheng.tool.statistics.DayEnergyStatistics
     * @author caijinkang
     * @date 2022/10/21 10:29
     */
    DayEnergyStatistics findEnergyByToday(Long workshopId, Integer unit);

    /**
     * 单位用电用水用气
     *
     * @param workshopId
     * @param range
     * @param begin
     * @param end
     * @return java.util.Map<java.lang.String, java.util.List < io.github.jhipster.sample.sansheng.tool.statistics.DateStatistics>>
     * @author caijinkang
     * @date 2022/10/21 13:35
     */
    UnitOfStatistics findUnitOfElectricity(Integer workshopId, String range, LocalDate begin, LocalDate end, Integer unit);

    /**
     * 车间能耗总分析PC端
     *
     * @param workshopId
     * @param range
     * @param begin
     * @param end
     * @param unit
     * @return io.github.jhipster.sample.sansheng.tool.statistics.UnitOfStatistics
     * @author caijinkang
     * @date 2022/11/10 11:24
     */
    WorkShopUnitStatistics findWorkshopEnergyTce(Integer workshopId, String range, LocalDate begin, LocalDate end, Integer unit);

    /**
     * 根据range抽离时间
     *
     * @param range
     * @param begin
     * @param end
     * @param format
     * @param datetime
     * @return io.github.jhipster.sample.sansheng.tool.statistics.RangeStatistics
     * @author caijinkang
     * @date 2022/10/20 16:16
     */
    RangeStatistics findDateByRange(String range, LocalDate begin, LocalDate end, String format, String datetime);

    /**
     * 设置小时表的数据导入到天表中
     *
     * @return java.lang.Integer
     * @author caijinkang
     * @date 2022/11/10 18:34
     */
    Integer setDayEnergyByHourEnergy();

    /**
     * 查询所有楼层信息
     *
     * @param buildId
     * @return java.util.List<com.ruoyi.common.core.domain.entity.Building>
     * @author caijinkang
     * @date 2022/12/5 11:09
     */
    List<Building> findAllFloorByBuildingId(Integer buildId);

    /**
     * 根据楼层信息查询车间信息
     *
     * @param buildingId
     * @return java.util.List<com.ruoyi.common.core.domain.entity.Workshop>
     * @author caijinkang
     * @date 2022/12/5 16:29
     */
    List<Workshop> findAllWorkshopByFloorId(Integer buildingId);

}

